﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinFormStore
{
    public partial class FrmForget : Form
    {
        public FrmForget()
        {
            InitializeComponent();
        }

        private void lblBackLogin_Click(object sender, EventArgs e)
        {
            FrmLogin frmLogin = new FrmLogin();
            frmLogin.Show();
        }

        private void lblRest_Click(object sender, EventArgs e)
        {
            string sql = "update SalesMan set Pwd=@Pwd where SalesmanName=@SalesmanName and Mobile=@Mobile";
            if (this.txtpwd.Text == this.txtpwd2.Text)
            {
                DBHelper.PrepareSql(sql);
                DBHelper.SetParameter("SalesmanName", this.txtname.Text);
                DBHelper.SetParameter("Mobile", this.txtacc.Text);
                DBHelper.SetParameter("Pwd", this.txtpwd2.Text);
                int rowCount = DBHelper.ExecuteNonQuery();
                if ( rowCount == 1)
                {
                    MessageBox.Show("修改密码成功!");
                }
                else
                {
                    MessageBox.Show("姓名或用户名错误,修改失败!");
                }
            }
            else
            {
                MessageBox.Show("两次密码输入不一致，请重新输入!");
            }
        }

        private void FrmRegister_Load(object sender, EventArgs e)
        {

        }


    }
}
